import request from '@/utils/request'

// 获取摊位管理列表
export function fetchPaymentItems() {
  return request({
    url: '/api/v2/backend/market/payment',
    method: 'post'
  })
}

// 缴费项目配置
export function fetchPaymentItemConfig() {
  const data = { differentFlag:"payment_all" }
  return request({
    url: 'api/v1/backend/public/different',
    method: 'post',
    data
  })
}

export function remove(id) {
  const data = { payTypeId: id }
  return request({
    url: 'api/v2/backend/market/payment/del',
    method: 'post',
    data
  })
}

export function add(payTypeName, price, unit, paymentTimeType, paymentTimeTypeName, timePos, day, months) {
  const data = { payTypeName, price, unit, paymentTimeType, paymentTimeTypeName, timePos, day, months }
  return request({
    url: 'api/v2/backend/market/payment/add',
    method: 'post',
    data
  })
}

export function edit(payTypeId, price, unit, paymentTimeType, paymentTimeTypeName, timePos, day, months) {
  const data = { payTypeId, price, unit, paymentTimeType, paymentTimeTypeName, timePos, day, months }
  return request({
    url: 'api/v2/backend/market/payment/edit',
    method: 'post',
    data
  })
}